package com.link510.aitools.data;


import com.link510.aitools.core.data.model.DeviceListModel;
import com.link510.aitools.core.message.MessageInfo;
import com.link510.aitools.core.data.CWMRetrofit;
import com.link510.aitools.core.data.model.DeviceShowModel;
import com.link510.aitools.core.data.restapi.DeviceService;

import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Query;

public class DeviceData {


    private static DeviceData mInstance = null;

    /**
     * 环境探测器服务
     */
    private DeviceService deviceService;

    /**
     * 单例
     *
     * @return EnvironData
     */
    public synchronized static DeviceData getInstance() {

        if (mInstance == null) {
            mInstance = new DeviceData();
        }

        return mInstance;
    }


    /**
     * 默认构造方法
     */
    private DeviceData() {
        deviceService = CWMRetrofit.instance().create(DeviceService.class);
    }

    /**
     * 获取广告列表
     *
     * @return 返回广告列表
     */
    public Observable<MessageInfo<DeviceShowModel>> get(String deviceSN) {
        return deviceService.get(deviceSN);
    }

    /**
     * 获取广告列表
     *
     * @return 返回广告列表
     */
    public Observable<MessageInfo<DeviceListModel>> list(String keyword) {
        return deviceService.list(keyword);
    }

}
